Drupal.behaviors.smsvidya_custom = function(){
     /*To remove starts in edit form*/
$('.form-required').hide();

     /*invite friend front page block*/
	 for(i=6;i<=9;i++){
c = "#edit-field-invite-friend-"+i+"-value";
$(c).parents('tr').css('display','none');
//$(c).hide();
}
$('#field_invite_friend_values').parents('div.standard').append('<input type="button" id="invite-friend-add-more" value="+ add more" />');

$('#invite-friend-add-more').click(function(){
	for(i=0;i<=9;i++){
	c = "#edit-field-invite-friend-"+i+"-value";
	if($(c).parents('tr').css('display')=='none')
	{
	$(c).parents('tr').css('display','');
	break;
	}
	if(i == 9){
	$('#invite-friend-add-more').hide();
	}
	}
});

var len = $('#edit-field-invite-friend-9-value').length;
if(len == 1)
{
	$('#edit-field-invite-friend-field-invite-friend-add-more').hide();
}


	 /* invite friend end*/	 
	var showText='<span class="more_show_arrow">more </span>';
	var hideText='<span class="more_hide_arrow">hide </span>';
	
	var is_visible = false;
	
	$('.more_link_mypage').append('<a href="#" class="more_link">'+showText+'</a>');
	$('.after_more').hide();
	$('a.more_link').click(function() {
	  is_visible = !is_visible;
	  $(this).html( (!is_visible) ? showText : hideText);	
	  $('.after_more').toggle('slow');	
	  return false;	
	});
	 
	
	 
	 /*Front page demo message phone number field, readonly attribute*/
$('#edit-field-mobile-number-0-value').attr('readonly',true);
	 //add to cart button value unset
		$('input.node-add-to-cart').val(""); 
		
		
			
		/*ask a question*/		 
		var ask_q = $('div.post_area div#edit-body-wrapper input#edit-body');
		if ($(ask_q).val()==="") {
				   $(ask_q).val('Ask a question and get answers');
				   }
		 
				$(ask_q).focus(function(){
				if ($(ask_q).val() == 'Ask a question and get answers') {
					$(ask_q).val('');
				}
				});
				$(ask_q).blur(function(){
				if (ask_q.val()==="") {
						$(ask_q).val('Ask a question and get answers');
				}
				});
				$('.popups-body input.post_btn').click(function(){location.reload();});				
				$('.popups-body input[type="submit"][value="Delete"]').click(function(){location.reload();});
				$('div.popups-body div.box input[type="submit"][value="Post"]').click(function(){location.reload();});
				$('div.popups-body div.box input[type="submit"][value="Save"]').click(function(){location.reload();});
			/*end question*/	
		

		
		


	
 /*Confirm password links*/

$('ul.catalog').addClass('select_cart_list');

/*invite friend vaidations*/
$('#edit-field-invite-friend-field-invite-friend-add-more').val('');
$('form#node-form input.invite').val('');

$('.invite').click(function(){
							flag = 0;
$("#field_invite_friend_values input:text").each(function(){
		 var id = $(this).attr('id');
		 if(id=='edit-field-invite-friend-0-value' || $(this).val() !==""){
		  // var mobile = /^((\+)?(\d{2}))?(\d{10}){1}?$/;
		  var mobile = /^[789][0-9]{9}$/;
		   if(mobile.test($(this).val()) === false){
			 $(this).css({'border': '1px solid #FF0000'});	
			 flag = 1;
		   }
		   else{
			$(this).css({'border': 'none'});
		   }
	}
});
if(flag){
	return false;
	}
});


$("div.banner_right input.go_banner_btn").click(function(){
sms_product= "#edit-field-categories-value";
if (sms_product.value === "") {  
  return false;
}
// value is set to a valid option, so submit form
return true;
});
		
		//sms go button value unset
		$('.banner_right input.go_banner_btn').val('');

		//removeing collapsible fieldset in uber cart checkout page
		$("#uc-cart-checkout-form fieldset#customer-pane").removeClass(' collapsible');
		$("#uc-cart-checkout-form fieldset#delivery-pane").removeClass(' collapsible');
	  

$('span.view_btn').each(function(){
var div_id =$(this).attr('id');
$('span.view_btn#'+div_id).click(function(){
$('div#c'+div_id+'').toggle('slow');
});
});

$('p.answer_btn_show').each(function(){
  var ans_id =$(this).attr('id');
  $('p#'+ans_id).click(function(){
//$('p#'+ans_id+'.answer_btn_show').hide();
//$('p.answer_btn_hide#'+ans_id).show();

  var l = $('div#c'+ans_id).length;
var s = $('div#b'+ans_id).length;
  if(l == '1' && s!='1'){
   $('div#c'+ans_id).toggle('slow');
   } else {
    $('div#b'+ans_id).toggle('slow');
  }
 });
});

$('span.details_arrow').each(function(){
var sid = $(this).attr('id');
$('span#'+sid).click(function(){
$('p.details_desc#'+sid).toggle('slow'); 
	 $('span#'+sid).toggleClass('details_arrow_active');
});

});

$('p.answer_btn_hide').each(function(){
  var ans_id =$(this).attr('id');
  $('p.answer_btn_hide#'+ans_id).click(function(){
    $('p#'+ans_id+'.answer_btn_show').show('slow');
    $('p.answer_btn_hide#'+ans_id).hide('slow');
  var l = $('div#c'+ans_id).length;
var s = $('div#b'+ans_id).length;
  if(l == '1' && s!='1'){
   $('div#c'+ans_id).hide('slow');
   } else {
    $('div#b'+ans_id).hide('slow');
  }


 });
});

$('input.node-add-to-cart').click(function(){location.reload();})
$('.views_slideshow_singleframe_teaser_section').css({'width':'98%','height':'150px'});

/*front page cat list width*/
$('#views_slideshow_singleframe_next_frontpage_catlist-block_1').click(function(){
  $('.views_slideshow_singleframe_slide').each(function(){
    var id = $(this).attr('id');
    if(id == 'views_slideshow_singleframe_div_frontpage_catlist-block_1_0'){
      $('#views_slideshow_singleframe_div_frontpage_catlist-block_1_0').css({
        'position': 'absolute','top': '0pt', 'left': '0px', 'display': 'block', 'z-index': '3','opacity': '1', 'width': '98%', 'height': '150px'});
    } else {
$('#views_slideshow_singleframe_div_frontpage_catlist-block_1_1').css({
        'position': 'absolute','top': '0pt', 'left': '0px', 'display': 'block', 'z-index': '3','opacity': '1', 'width': '98%', 'height': '150px'});
    
	}
  });
});

$('div.receive_message').hide();
var msg = $('div.receive_message').html();
$('span.pdt_cnt').html(msg);

$('div.common_node').each(function(){

var id = $(this).attr('id');
//var p = '';
var len1 = $('div#'+id+' div#1.comment').length;
var len2 = $('div#'+id+' div#2.comment').length;
var com1 =$('div#'+id+' div#1.comment').html();
var com2 =$('div#'+id+' div#2.comment').html();
var df = com1+com2;
if(len1 !== 0 && len2 !== 0){
		

$('div#firsttwo'+id).html(df);
} else if(len1 !== 0){
	

  $('div#firsttwo'+id).html(com1);
}else if(len2 !== 0){
	

  $('div#firsttwo'+id).html(com2);
} else {
	
	$('div#firsttwo'+id).html('');
}

});
$('#search').change(function(){
ss = ""+window.location;
pos = ss.lastIndexOf("/");
act = ss.substr(0,pos);
window.location = act+"/"+$(this).val();
})

$('#test_name').change(function(){
ss = ""+window.location;
act = ss.replace(/[0-9]+/, $(this).val());
window.location = act;
})

$('div.testpage_catlist span img').each(function(){$(this).click(function(){

ss = $(this).attr('title');
$('#accordion h3 a').each(function(){if($(this).html() == ss)
{
 $(this).parent().removeClass('ui-state-default');
$(this).parent().addClass('ui-state-active');
$(this).parent().trigger('click');
}
else{
 $(this).parent().removeClass('ui-state-active');
$(this).parent().addClass('ui-state-default');
}
})

})})
var count=0;
$('#quiz-question-answering-form div.quiz-question-body p').each(function(){++count;
$(this).before("<span class='qno'>"+count+"</span>");})

/* recommend module*/
$("span#more-mod").click(function(e){e.preventDefault()});/*
$('#more-mod').click(function(){$('div.main-mod').slideToggle('slow')});
*/
/*to display marks in proper position*/
$('div.marks_dup').html($('div.marks').html());
/*questions test page */

$('#quiz-question-answering-form input:radio').change(function(){nam = $(this).attr('name');
															   $('.'+nam).remove();});	

//$('input[name="answer_203"]').change(function(){$('.answer_203').remove()})

$('#quiz-question-answering-form #edit-submit').click(function(){
count = 0;
$('input:radio').each(function(){
nam = $(this).attr('name');
if($("input[name='"+nam+"']:checked").length <= 0) {
count++;

if($('.'+nam).length <=0){
 $(this).parents('.form-radios').prepend("<span class='qno_err_msg "+nam+"'>You must provide an answer</span>"); }
}
})
if(count > 0){
return false;} } ) 




$('.view-display-id-block_1 input[type="checkbox"]').change(function() {
var selector_checked = $(".view-display-id-block_1 input[type=checkbox]:checked").length;
var s = $(this).attr('id');
var r = $(".view-display-id-block_1 input[type=checkbox]:checked").attr('id');
if(selector_checked > 1)
{
	
      alert('Only one free module is allowed..!');
$('input#'+s).attr('checked',false);
     }
});
//content and test page disable
/*$("a[href='/livesmsvidya/content/videos']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/tests']").click(function(e){e.preventDefault()});
$("a[title='Content']").click(function(e){e.preventDefault()});
$("a[title='Tests']").click(function(e){e.preventDefault()});*/
$("a[innerHTML=Recent Activities]").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/6']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/6'] img").hover(function(){$(this).attr('title','coming soon')});
$("a[href='/livesmsvidya/catalog/2']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/2'] img").hover(function(){$(this).attr('title','coming soon')});
$("a[href='/livesmsvidya/catalog/5']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/5'] img").hover(function(){$(this).attr('title','coming soon')});

$("a[href='/livesmsvidya/catalog/32']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/32'] img").hover(function(){$(this).attr('title','coming soon')});
$("a[href='/livesmsvidya/catalog/33']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/33'] img").hover(function(){$(this).attr('title','coming soon')});
$("a[href='/livesmsvidya/catalog/34']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/34'] img").hover(function(){$(this).attr('title','coming soon')});

$("a[href='/livesmsvidya/catalog/35']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/35'] img").hover(function(){$(this).attr('title','coming soon')});
$("a[href='/livesmsvidya/catalog/36']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/36'] img").hover(function(){$(this).attr('title','coming soon')});
$("a[href='/livesmsvidya/catalog/37']").click(function(e){e.preventDefault()});
$("a[href='/livesmsvidya/catalog/37'] img").hover(function(){$(this).attr('title','coming soon')});

}